package com.houg.testorderapi.service.ipml;

import com.houg.payapi.entity.PayInfo;
import com.houg.payapi.service.PayService;
import com.houg.testorderapi.service.GetPayService;
import org.apache.dubbo.config.annotation.Reference;
import org.springframework.stereotype.Service;


/**
 * @Author: NALHOUG
 * @Time: 2019/11/11 23:03
 * @Explain:
 */

@Service
public class GetPayServiceImpl implements GetPayService {
    private static final String ALI_PAY="ali";
    private static final String WE_CHAT_PAY = "weChat";
    private static final String UNION_PAY = "union";

    @Reference
    private PayService payService;

    @Override
    public String getPay(PayInfo payInfo) {
        switch (payInfo.getPay()){
            case ALI_PAY:
                return payService.aliPay(payInfo);
            case WE_CHAT_PAY:
                return payService.weChatPay(payInfo);
            case UNION_PAY:
                return payService.unionPay(payInfo);
            default:
                return "支付错误，请重试";
        }

    }
}
